package com.woniuxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;

@Controller
public class TestExceptionController{
    @RequestMapping(value = "/testController1")
    public String testController1()throws Exception{
        throw new Exception();
    }
    @RequestMapping(value = "/testController2")
    public String testController2(){
        int i=10/0;
        return "success";
    }
    @RequestMapping(value = "/testController3")
    public String testController3()throws Exception{
        try {
            int i=10/0;
        } catch (Exception e) {
           throw new SQLException("数据没有查找到");
        }
        return "success";
    }
}
